package org.broadinstitute.hellbender.tools.spark.sv.discovery.alignment;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import org.broadinstitute.hellbender.GATKBaseTest;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.*;

import static org.broadinstitute.hellbender.tools.spark.sv.discovery.TestUtilsForAssemblyBasedSVDiscovery.fromPrimarySAMRecordString;
import static org.broadinstitute.hellbender.tools.spark.sv.discovery.TestUtilsForAssemblyBasedSVDiscovery.fromSAMRecordString;

public class AssemblyContigWithFineTunedAlignmentsUnitTest extends GATKBaseTest {

    @Test(groups = "sv")
    public void testSerializationAndHashCode() {
        final AlignmentInterval one = fromSAMRecordString("asm002362:tig00002\t16\tchr2\t1422222\t60\t75M56I139M\t*\t0\t0\tATGCTGGGGAATTTGTGTGCTCCTTGGGTGGGGACGAGCATGGAAGGCGCGTGGGACTGAAGCCTTGAAGACCCCGCAGGCGCCTCTCCTGGACAGACCTCGTGCAGGCGCCTCTCCTGGACCGACCTCGTGCAGGCGCCTCTCCTGGACAGACCTCGTGCAGGCGCCTCTCCTGGACCGACCTCGTGCAGGCGCCGCGCTGGACCGACCTCGTGCAGGCGCCGCGCTGGGCCATGGGGAGAGCGAGAGCCTGGTGTGCCCCTCAGGGAC\t*\tSA:Z:chr2_KI270774v1_alt,105288,-,114M1I27M1I127M,56,13;\tMD:Z:214\tRG:Z:GATKSVContigAlignments\tNM:i:56\tAS:i:142\tXS:i:0\n",
                true);
        final AlignmentInterval two = fromSAMRecordString("asm002362:tig00002\t2064\tchr2_KI270774v1_alt\t105288\t56\t114M1I27M1I127M\t*\t0\t0\tATGCTGGGGAATTTGTGTGCTCCTTGGGTGGGGACGAGCATGGAAGGCGCGTGGGACTGAAGCCTTGAAGACCCCGCAGGCGCCTCTCCTGGACAGACCTCGTGCAGGCGCCTCTCCTGGACCGACCTCGTGCAGGCGCCTCTCCTGGACAGACCTCGTGCAGGCGCCTCTCCTGGACCGACCTCGTGCAGGCGCCGCGCTGGACCGACCTCGTGCAGGCGCCGCGCTGGGCCATGGGGAGAGCGAGAGCCTGGTGTGCCCCTCAGGGAC\t*\tSA:Z:chr2,1422222,-,75M56I139M,60,56;\tMD:Z:94C17G1G6T13T3G1G34A3T9T68T8\tRG:Z:GATKSVContigAlignments\tNM:i:13\tAS:i:179\tXS:i:142",
                true);
        final AlignedContig sourceTig = new AlignedContig("asm002362:tig00002", "GTCCCTGAGGGGCACACCAGGCTCTCGCTCTCCCCATGGCCCAGCGCGGCGCCTGCACGAGGTCGGTCCAGCGCGGCGCCTGCACGAGGTCGGTCCAGGAGAGGCGCCTGCACGAGGTCTGTCCAGGAGAGGCGCCTGCACGAGGTCGGTCCAGGAGAGGCGCCTGCACGAGGTCTGTCCAGGAGAGGCGCCTGCGGGGTCTTCAAGGCTTCAGTCCCACGCGCCTTCCATGCTCGTCCCCACCCAAGGAGCACACAAATTCCCCAGCAT".getBytes(),
                Arrays.asList(one, two));
        final AssemblyContigWithFineTunedAlignments tig =
                sourceTig
                    .reconstructContigFromBestConfiguration(new HashSet<>(Collections.singletonList("chr2")), 0.0)
                    .get(0);

        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
        final Output out = new Output(bos);
        final Kryo kryo = new Kryo();
        kryo.writeClassAndObject(out, tig);
        out.flush();

        final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        final Input in = new Input(bis);
        @SuppressWarnings("unchecked")
        final AssemblyContigWithFineTunedAlignments roundTrip = (AssemblyContigWithFineTunedAlignments) kryo.readClassAndObject(in);
        Assert.assertEquals(tig, roundTrip);
        Assert.assertEquals(tig.hashCode(), roundTrip.hashCode());
    }

    @DataProvider
    private Object[][] forTestingHasChimericAlignments() {
        final List<Object[]> data = new ArrayList<>(20);

        buildDataForUnmappedContig().forEach(tig -> data.add(new Object[]{tig, false}));

        buildDataForNormalContigs().forEach(tig -> data.add(new Object[]{tig, false}));

        buildDataForSimpleChimeraContigs().forEach(tig -> data.add(new Object[]{tig, true}));

        buildDataForComplexChimeraContigs().forEach(tig -> data.add(new Object[]{tig, true}));

        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forTestingHasChimericAlignments")
    public void testHasChimericAlignments(final AssemblyContigWithFineTunedAlignments assemblyContigWithFineTunedAlignments,
                                          final boolean expected) {
        Assert.assertEquals(assemblyContigWithFineTunedAlignments.hasChimericAlignments(), expected);
    }

    @DataProvider
    private Object[][] forGetAlignmentSignatureBasicType() {
        final List<Object[]> data = new ArrayList<>(20);

        buildDataForNormalContigs().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.NORMAL}));

        buildDataForSimpleChimeraContigs().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.SIMPLE_CHIMERA}));

        buildDataForComplexChimeraContigs().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.COMPLEX}));

        buildDataForUnmappedContig().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.UNKNOWN}));

        buildDataForAmbiguousAlignmentSignature().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.UNKNOWN}));
        buildDataForUnInformativeAlignmentSignature().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.UNKNOWN}));
        buildDataForIncompleteAlignmentSignature_2aln().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.UNKNOWN}));
        buildDataForIncompleteAlignmentSignature_multipleAln().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType.UNKNOWN}));

        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forGetAlignmentSignatureBasicType")
    public void testGetAlignmentSignatureBasicType(final AssemblyContigWithFineTunedAlignments contig,
                                                   final AssemblyContigWithFineTunedAlignments.AlignmentSignatureBasicType expected) {
        Assert.assertEquals(contig.getAlignmentSignatureBasicType(), expected);
    }

    @DataProvider
    private Object[][] forGetReasonForAlignmentClassificationFailureExpectException() {
        final List<Object[]> data = new ArrayList<>(20);

        buildDataForUnmappedContig().forEach(tig -> data.add(new Object[]{tig}));
        buildDataForNormalContigs().forEach(tig -> data.add(new Object[]{tig}));

        buildDataForSimpleChimeraContigs().forEach(tig -> data.add(new Object[]{tig}));

        buildDataForComplexChimeraContigs().forEach(tig -> data.add(new Object[]{tig}));
        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forGetReasonForAlignmentClassificationFailureExpectException",
            expectedExceptions = UnsupportedOperationException.class)
    public void testGetAlignmentSignatureBasicType(final AssemblyContigWithFineTunedAlignments contig) {
        contig.getReasonForAlignmentClassificationFailure();
    }

    @DataProvider
    private Object[][] forGetReasonForAlignmentClassificationFailure() {
        final List<Object[]> data = new ArrayList<>(20);

        buildDataForIncompleteAlignmentSignature_2aln().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.ReasonForAlignmentClassificationFailure.INCOMPLETE}));
        buildDataForIncompleteAlignmentSignature_multipleAln().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.ReasonForAlignmentClassificationFailure.INCOMPLETE}));

        buildDataForAmbiguousAlignmentSignature().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.ReasonForAlignmentClassificationFailure.AMBIGUOUS}));

        buildDataForUnInformativeAlignmentSignature().forEach(tig -> data.add(new Object[]{tig, AssemblyContigWithFineTunedAlignments.ReasonForAlignmentClassificationFailure.UNINFORMATIVE}));

        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forGetReasonForAlignmentClassificationFailure")
    public void testGetReasonForAlignmentClassificationFailure(final AssemblyContigWithFineTunedAlignments contig,
                                                               final AssemblyContigWithFineTunedAlignments.ReasonForAlignmentClassificationFailure expected) {
        Assert.assertEquals(contig.getReasonForAlignmentClassificationFailure(), expected);
    }

    @DataProvider
    private Object[][] forTestHasIncompletePicture() {
        final List<Object[]> data = new ArrayList<>(20);

        buildDataForUnmappedContig().forEach(tig -> data.add(new Object[]{tig, false}));
        buildDataForNormalContigs().forEach(tig -> data.add(new Object[]{tig, false}));
        buildDataForSimpleChimeraContigs().forEach(tig -> data.add(new Object[]{tig, false}));
        buildDataForComplexChimeraContigs().forEach(tig -> data.add(new Object[]{tig, false}));

        buildDataForIncompleteAlignmentSignature_2aln().forEach(tig -> data.add(new Object[]{tig, true}));
        buildDataForIncompleteAlignmentSignature_multipleAln().forEach(tig -> data.add(new Object[]{tig, true}));
        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forTestHasIncompletePicture")
    void testHasIncompletePicture(final AssemblyContigWithFineTunedAlignments contig, final boolean expectedHasIncompletePicture) {
        Assert.assertEquals(contig.hasIncompletePicture(), expectedHasIncompletePicture);
    }

    @DataProvider
    private Object[][] forTestHasIncompletePictureFromTwoAlignments() {
        final List<Object[]> data = new ArrayList<>(20);
        buildDataForIncompleteAlignmentSignature_2aln().forEach(tig -> data.add(new Object[]{tig}));
        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forTestHasIncompletePictureFromTwoAlignments")
    public void testHasIncompletePictureFromTwoAlignments(final AssemblyContigWithFineTunedAlignments contig) {
        Assert.assertTrue(contig.hasIncompletePicture());
    }

    @DataProvider
    private Object[][] forHasIncompletePictureFromMultipleAlignments() {
        final List<Object[]> data = new ArrayList<>(20);
        buildDataForIncompleteAlignmentSignature_multipleAln().forEach(tig -> data.add(new Object[]{tig}));
        return data.toArray(new Object[data.size()][]);
    }
    @Test(groups = "sv", dataProvider = "forHasIncompletePictureFromMultipleAlignments")
    public void testHasIncompletePictureFromMultipleAlignments(final AssemblyContigWithFineTunedAlignments contig) {
        Assert.assertTrue(contig.hasIncompletePicture());
    }

    //==================================================================================================================

    // unmapped
    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForUnmappedContig() {
        final AlignedContig alignedContig = new AlignedContig("asm000000:tig00000", "CCCCGAACTTTCTCCAGCCAAGCTCTGAGGGCCCACCTCCTGCCTCCTGGTGGCCTGTACAGGCCCAGCACTGGTTGGAGAACAGCCTCTGCAGGCCCCGCCCTTGCCTACCAGGGGCCTCTCCAGGCGCAGCTCTTGCCCCCACGGCGGCCTCCCGGGGCCAAGTCCCTGCCTGCCTCCCAGCAGCCCACGTGCGGCCCAGCTCCTCTCTCACGGTGGCCTGTTGATGCCCACCCTCCCACGCGGACAGAGGTCAGCCTGAGCCCCTTGCCTCACACCGGCCCCTCCCACGCGGACAGAGGTCAGCCTGAGCCCCTTGCCTCACACCGGCCCCTCCCACGCTGAGAGAGGTCAGTGTGAGCCCCTGCCTCAACAGGCCACCGTGAGGGAGGAGCAGGGTCGCACGCGGGCTGCTGG".getBytes(), Collections.emptyList());
        return Collections.singletonList(new AssemblyContigWithFineTunedAlignments(alignedContig));
    }

    // one good alignment
    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForNormalContigs() {

        final AlignmentInterval singleAlignment = fromSAMRecordString("asm000000:tig00000\t0\tchr7\t128653321\t60\t417M\t*\t0\t0\tCCCCGAACTTTCTCCAGCCAAGCTCTGAGGGCCCACCTCCTGCCTCCTGGTGGCCTGTACAGGCCCAGCACTGGTTGGAGAACAGCCTCTGCAGGCCCCGCCCTTGCCTACCAGGGGCCTCTCCAGGCGCAGCTCTTGCCCCCACGGCGGCCTCCCGGGGCCAAGTCCCTGCCTGCCTCCCAGCAGCCCACGTGCGGCCCAGCTCCTCTCTCACGGTGGCCTGTTGATGCCCACCCTCCCACGCGGACAGAGGTCAGCCTGAGCCCCTTGCCTCACACCGGCCCCTCCCACGCGGACAGAGGTCAGCCTGAGCCCCTTGCCTCACACCGGCCCCTCCCACGCTGAGAGAGGTCAGTGTGAGCCCCTGCCTCAACAGGCCACCGTGAGGGAGGAGCAGGGTCGCACGCGGGCTGCTGG\t*\tMD:Z:417\tRG:Z:GATKSVContigAlignments\tNM:i:0\tAS:i:417\tXS:i:214", false);
        final AlignedContig alignedContig = new AlignedContig("asm000000:tig00000", "CCCCGAACTTTCTCCAGCCAAGCTCTGAGGGCCCACCTCCTGCCTCCTGGTGGCCTGTACAGGCCCAGCACTGGTTGGAGAACAGCCTCTGCAGGCCCCGCCCTTGCCTACCAGGGGCCTCTCCAGGCGCAGCTCTTGCCCCCACGGCGGCCTCCCGGGGCCAAGTCCCTGCCTGCCTCCCAGCAGCCCACGTGCGGCCCAGCTCCTCTCTCACGGTGGCCTGTTGATGCCCACCCTCCCACGCGGACAGAGGTCAGCCTGAGCCCCTTGCCTCACACCGGCCCCTCCCACGCGGACAGAGGTCAGCCTGAGCCCCTTGCCTCACACCGGCCCCTCCCACGCTGAGAGAGGTCAGTGTGAGCCCCTGCCTCAACAGGCCACCGTGAGGGAGGAGCAGGGTCGCACGCGGGCTGCTGG".getBytes(), Collections.singletonList(singleAlignment));
        return Collections.singletonList(new AssemblyContigWithFineTunedAlignments(alignedContig));
    }

    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForSimpleChimeraContigs() {

        final List<AssemblyContigWithFineTunedAlignments> data = new ArrayList<>(2);

        // has two alignments and indicates simple deletion
        AlignedContig simpleDel = fromPrimarySAMRecordString("asm000021:tig00001\t0\tchr1\t1039759\t60\t1343M11D604M400S\t*\t0\t0\tTGACAGAGAGTGAGGGCGATGGAGGAGGCAAGAGTGAGGTGGGGGGCCGGGGGATGCCCAGGGAGGAGGGGGCGTGTGGGTGCCCCAGGGATCCCAGGGAGCGATGGGAGGCTGCAGAAGGGCACAGGCCTGCCGCGGGTGGGGGGCTGGCCAGGGAGAATAGGAGATAGTAGAGGCGGAGGCCAGGAATTTGCACTT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CTC\t*\tSA:Z:chr1,1041824,+,1913S434M,60,2;\tMD:Z:563A725C53^GGAGCGGGGCG21C571A10\tRG:Z:GATKSVContigAlignments\tNM:i:15\tAS:i:1900\tXS:i:0",
                true);
        data.add(new AssemblyContigWithFineTunedAlignments(simpleDel));

        // has two alignments and indicates simple insertion
        AlignedContig simpleIns = fromPrimarySAMRecordString("asm021002:tig00000\t0\tchr13\t28584810\t60\t1133S598M\t*\t0\t0\tATAATAATAATAATAATAATAATAATAATAAATGTATAAAAAGTGAAGTCCCTGGTACCTGTTAAATGTTCAGTAGGTGTTTGTTGTTGTTATTGGGCAAAAAGTGAGTTTTGCCCTCTCCCTTGTCCTCTCCCTCTGCATGGAATCAATAGCCAAGTCCTTCCTAACCTCCGTTCTCTTTGTTCCTCTCCCTCCCTTCCCTATTTCTTATTAGGCCTTTCTCACCATCCTCACAGGCAACACAGCAATAGCAGCTGTGAGTCTCCTGTCTGCCCAAGAAGGTGCCCCCTCATCAGGAAGCCGGCTCTCCTCTCACACCAGCTGGCAGGGGCCTCTCCAACCCCTGAGCTCCAAGCACACATCGCTTCCACATTCCTGTGACATGTGCCACAGTCAGCCTGGCATTGCGGTGTCTGAGCACCTGTCATTGCATCTGTGCTGAATCAGGCACTGTGAGTGCAAGGCCAGGCCCCGTGGACTTGGGTTCCCACGGGCACCTGGCAGGTTGTGGGAAGTGCTCGTTCCATCCGGAATGTGGACTTCAGGAAAGGACACCCCAACATATGCTGCTTTGGTATGCTGCTTTCTTTGCACTTAGGGCACTTGGAGAACAGCAAAGGCAGCAGGGAGCTCTCTCTGAGGTCCCCTTATTTGCCTAAAGACAAGAGCCTCCGAAAGGGATTCTCACCAACCAGGGAAGATTAAGCACGAATCAGAGGAGAGGAGTCTGGAGGCCACACTACACCCAGACATAGACTTGTCACAGGCTGTCCCCTGTTCTTCTGAGGGCCCGTTCATCTTCCCCAAAATCATTTACTCTCCCCCAAGTTGCCTGCATTCCCCCTCCACTCTCCCCTGTGGAGCCGGTGTCTAAACTCCTAGATCTCGCTGGGCTTGGGGTGCTCACTTTTCCTTCCTCTGATGCCCGTGTGCATATAATACATTTGTATCTCTTTTTTCCTGATAATCTGTCTGTTGTCAGTTTATTTCACAGACTCAGATCTCCAACTCTCTAGAGGGAAAGTTTTCCCTTTCCTACAAATGTAATGACAAAAACAGCATGTACCAAATGGGCTAACAAATGAATGAAAACATTTTATCCCACACATTTCCTCCTATGAAGCCACCAAGAGGTGGGTGAATAAAGGCTGCCTAAGCCCATTTCCTATGGACCATATCCTCAAATAGCACATACCTACCGGTAAGTGTCCATGTCACCCTCTGAGCAGGACACCAAAACCACATTTTGTGATCTCTAGTTTTCTGGGATTTATAATATAAAAAGAAACCTGATGCAACATTCCAGGGCTATTACAAGTCAAATTCCAATGCTACAAACTCTAAAAGATCATAAAATACATCCTAACAAAGATTACTTCCAATAAGAGAATCTGGCTGGCTAAGGTTTTAAAATCTCTTGGTTTGTCAAATAGACACTTTGTTATAATTTGATTTTACTTGTGGCATTACTAGCAAACTTTGTAAATCCCAAGTATACTTTGGCAGGGTAGATGGATGGAATTGTTGGGAAAGCCTTAGGGTGGAAAACATTAACTAGAGCTTAAGAAAAAATGCACAAAGGAAATGAGGAAAGGATAGGCAGATGGGGAATTCAGTGAGGTTTCGATGGACTCGTGCTCGGTCCTGTGCCTGATATCTTCTTCCTCTTGGTGTGTTTCTTTGCAGAACATTGACAACCCTCAAGATAACAGGGGCATCTGAGAAATGTAG\t*\tSA:Z:chr13,28584682,+,128M1603S,60,0;\tMD:Z:441T156\tRG:Z:GATKSVContigAlignments\tNM:i:1\tAS:i:593\tXS:i:0", true);
        data.add(new AssemblyContigWithFineTunedAlignments(simpleIns));

        // has two alignments and indicates small duplication expansion
        AlignedContig smallDupExpansion = fromPrimarySAMRecordString("asm030976:tig00000\t0\tchrX\t124128553\t60\t486S26M1D126M1D1083M\t*\t0\t0\tATAAGAATTTTTCTTAATACACAACAAAATGAAAAGTCTCCCATGTCTACCTCTTTCCACACAGACGCAGCAACC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TATTAATAGGTATATTTTTTGAGACAGAGTCTTGTTCTGTCACCCAGGCTGGAGTGCAGTGGCAAGATCTTGGCTCACTGCAGCCTGTGCCTCTCAGGTTTAAGTGATTCTCATCATGCCTGAGCCTGTCGAATAGCCGGGATTACAGGCGTCTGCCACTACCCATGCTAACTTTTGTATTTTTTGTGGAGACGGGGTTTCACCATGTTGCCCAGGCTGGTCTGGAGCTCCTGACCTCAAGTGATCCACCCACCTTGGTCTCCCAAAGTGCTGGGATTACAGGCATGAGCCATCGCGCCCGGCCAATATAACATACTTTTAAATGACATTTTTTTTTTTGGTGTATAGGTCTCTAAGGAGTTCATAAACAATTTTATGGTGTCATTTTTCTGAATTTCCCCTCTTTCCCTCTCTGCCATCTTTCTGATACTTTCAGGTTTCTAAGGCTTCCATATTCAGTCCTCTGACCAGGAAACTGGCATTTTTAGTTAGTTCATTCTGCCATATATTAATACTTCTTGTGACTGTGCCCATGTCTGGAAGGAAA\t*\tSA:Z:chrX,124128293,+,485M1236S,60,4;\tMD:Z:7T18^C12C7C17G1G22C3A26C3C27^C27G6C3C1044\tRG:Z:GATKSVContigAlignments\tNM:i:14\tAS:i:1141\tXS:i:560", true);
        data.add(new AssemblyContigWithFineTunedAlignments(smallDupExpansion));

        // has two alignments and indicates small duplication contraction
        AlignedContig smallDupContraction = fromPrimarySAMRecordString("asm000629:tig00002\t16\tchr1\t34801124\t60\t1214M264S\t*\t0\t0\tTTTGATACAGACTGCCAAGCTGCTTTCCAGAAAAAAAAATTACTTATTCGTTCAATAGCATTGTATGAAAGTGCTCATTTCAAGGTATGCATACAAGCATTATTGTAATTTTTAAATTGCTTTGCCTATTATTAATTATTAAACAGGGAAAAAATGGTATCACGTTTCATGAGGGAGGCCTGATTACTAGTGAGTGTAGACTTCTATGTGTGTGTGTGTGTGTGGCAGGTCTTACTCTGTTTCCCAGACTGGAGTGCCGTGGTACAATCTCAACTCACTACAACCTCCATCTCCCAGGCTTAAGCAATTCTTGTGCCTCAGCATCCCTAGTAGCTGGGATTACAGGTGCGTGCCACCATGCCGGGCTAATTTTTGCATTTTCTTGTAGAGATGGGGTTTCACCATGTAGCCTAGGCTGGTCTCAAACTCCTGGACTCAAGCAATCCACCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCATAAGCCACCATGCCTGGCTAGTGAGGGTAGATTTTTTAACGTATACTTCTTCAGCACTTATGTTTGTTCTATGAATGTTTTTTGCCCATTTTTCTATCAGGTTTTACTATTTTCTGATCAACTTGTATAAACTCTTTATAGGTAGAGGATATCAACCCTTCATCTGGCATATGTTATAAAAATTTTTCTGTATTATTTTGTTCCTTTGTCTGCAGATATTTTTAATTTCTATGTAGTCAAATTTATGGATTTTTTTCCTTTCCAGTAACTTTAGGCTTACACTGTTATCCCCTTTTCAATATTATTTTTAATTTTATACTTTAACCTGGCTTGAACATAATAGGAGAAAAATAATTATTGAACAAAAGACAAAGCATGAACAAACAACCTAATTTTAGCATATAAGGTGAAGTGCTAACTTTTCCCCCCAAATAATCAATGGTTTTGGCAGCACTTATTGGATAATCCTTCCTATACTAATTTGTGATAACAGCTTCACTATACTATATGTAACAGACTACATTTTATAGACTACCTATAATTCTGTTCCATTAATCTGTCAATTTATGTGATACTACCACTCTTTTCATTAGTGTAGCTTTCTAACACAATCTTTTCGGGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTGGTTTCGAGATAGGATCTAGCTCTGTTGCCCAGGCTGGAGTGCAGTGGTGCGATCTTGGCTCACTGCAGTCTCCACCTCCTGTACTCAAGCCATCCTCCCACCTCAACCTCCCCAGTAGCTGGAACCACAGGCACACACCACTATGCATGGCTAATTTTTGTATTTTTGTGTGGAGACGGGGGTCTCACTATGCTGCCCAGGCTGGTCTCGAACAACTGAGCTCAAGCAATCACCCATCTCGGCCTCCCAAAGTGCTGGGATTACAGGC\t*\tSA:Z:chr1,34802338,-,1104S374M,60,0;\tMD:Z:733C480\tRG:Z:GATKSVContigAlignments\tNM:i:1\tAS:i:1209\tXS:i:54", true);
        data.add(new AssemblyContigWithFineTunedAlignments(smallDupContraction));

        // has two alignments and indicates small complex duplication expansion
        AlignedContig smallCpxDupExpansion = fromPrimarySAMRecordString("asm031149:tig00001\t2048\tchrX\t151072096\t60\t628M10I48M4I24M2I98M2D72M1D54M2I34M1018H\t*\t0\t0\tACAAAATAATAAATCACTGAAGTAGAAGACAATTGAAAAATAAATTTCAGTTAACAGGGTAGTTCTTATGGTAAAATAAAAAGTAAAAAAAAGACAAGAAAAATTAAGATATATATGAAAAAAGAAAAATAAATTGAGGAGCTGGGTCTTTGAAAAGATAAAATTGGCTAAACTTGGGTAAATAATATTGGGAAAAAAGAATCATACAAGTACACATGACTCAATGCCAAATGATATCTCTAGTCCAGATACAGATGTTTAAAAAAAATTATGCAGGCTGGGTGCAGTGGCTCACACCTGTAATCTCAACACTTTGGGAGGTCGAGGCAGGCGGATCACCAGGTCAGGATACCAAGACCAGCCTGGCCAACATGGTGAAGCCTCGTCTCTACTAAAAATACAAAAATTAGCCAGGCGTGGTGGCGGGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGATTGAACCTGGGAGGCAGAGCTTGCAGTGAGCCTAGATCGCACCACTGCACTCCGGCCTGGGTGACAGAGCAAGACTCCATCTCAAAAAACAACAAATACATATATATATATGTGTGTATATATATATGTATATATATGTATATATGTATATATATGTATATATGTATATATATGTATATATGTATATATGTGTATATATGTATATATGTATATATATGTATATATGTGTATATATGTATATATGTGTATATATGTATATATGTATATATGTATATATGTATATGTGTATATATGTATATATGTATATATGTATATATGTATATATGTGTATATATGTATATATATATATGTGTATATGTGTATATATGTATATGTGTATATATGTATATATGTATATGTGTATATATGTGTATATGTGTATATGTGTATATATGTATATATGTGTATATATGTGTATATATGTATATATGTGTATATATGTGTATATGTGTATATATGTGTATA\t*\tSA:Z:chrX,151072684,+,858S54M2I28M4I94M4D97M9D36M9I362M2I448M,60,69;\tMD:Z:217A261C197G37G19G3A7G19G5A1G22^TG1G25G3A1A1G1G3A3G3A17A4^C0A8A61A16\tRG:Z:GATKSVContigAlignments\tNM:i:44\tAS:i:726\tXS:i:133", true);
        data.add(new AssemblyContigWithFineTunedAlignments(smallCpxDupExpansion));

        // has two alignments and indicates small complex duplication contraction
        AlignedContig smallCpxDupContraction = fromPrimarySAMRecordString("asm030197:tig00003\t2064\tchrX\t1611145\t60\t739M5D44M1I28M717H\t*\t0\t0\tGTCGCCCAGGCTGGAGTGCAGCGGCGCGATCTCGGCTCACTGCAACCGCCACCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCAAGTTGCTAGGATAACAGGCATGCACTGCCACGCCCAGCTAATTTTTTGTATTTGTAGAAGAGATGGGGTTTCACCATGTTGGCAGGCTGGTCTCAAACTGCTGACCTCAAATGATCCACCTGTCTTCGCCTCCCAAACTGCCCGGATGACACATGTGAGCCACCACACCTGGCCCAGATCTGATGGTTTTATAAATGGGAGGTCCCCTGCTGCACACGCCCTCTGGCCTGTCACCAGGTAAGACATGCCTTTGCTTCTCCTTGGCTTTCCTGCCATGAGTGTGATATGTATTTATCAGCAACATGAAAATGGACTAATACAATATGCTTGTCAGCCACGTGTGTGTCTTTTTTTGGAGAAGTGTCTGTTGGCCGGGCGCGGTGGCTCACGCCTGTCATCCCAGCACTTTGGGAGGCCGAGGCGGGTGGATCACGAGGTCAAGAGATCGAGACCATCCTGGCTAACATGGTGAAACCCCGTCTCTACTAAAGATACAAAAAATTAGCCAGGTGTGGTGGTGGGCGCCTGTAGTCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCTCTTGAACCCGGGAAGCGGAGCTTGCAGTGAGCTGAGATCGTGCCACTGCACTCCAGCCTGGTGACAGAGCGAGATTCCATCTCAAAAAAAAAAAAATTACCCAAAATTACGCAGTCTCAGATATGTCTTTATCAGCAGCATGAAAACGGACTAATA\t*\tSA:Z:chrX,1611957,-,410S329M1D668M4I118M,60,11;\tMD:Z:172T35G24A65T129C9C4T34T76C10T9G2A15T0G1C8C0T2T9T10T20G0A1A0C10G26A33C8^AAAAA27C9G24T9\tRG:Z:GATKSVContigAlignments\tNM:i:36\tAS:i:623\tXS:i:68", true);
        data.add(new AssemblyContigWithFineTunedAlignments(smallCpxDupContraction));

        // has two alignments and indicates intra-chromosome strand switch BND
        AlignedContig inv33 = fromPrimarySAMRecordString("asm022624:tig00004\t16\tchrX\t28601137\t60\t179S653M\t*\t0\t0\tATCATCAAATCAAGAGATATTATCAGAAGAGCTTTCTCAATTTCTACTGTTTAACAGTATATCTTCCTTGCATAGCCCTATAAATATACTAAAAAGCTTGGAATTGTATAGTTAAAACATGTGATTATTATATTATATAAAATATACCCCAGTAAAGCCTTTTTTAAAAAATTAACATGTCGGCCGGGCACGGTGGCTCATGCCTGTAATCCCAGCACTTTGGGAGGCTGAGGTGGGCGGATCATGAGGTAAAGAGATCGAGACCATCCTGGCCAACATGGTGAAACCCTGTCTTTACTAAAAAAATACAATAATTAGCTGGGCGTGGTGGCGCGTGCCTGTAGTACCAGCTACTCTAACTAGAGGCTGAGGCAGGAGAATTGCTTGAACCTGGGAGGCAGAGGTTGCAGTGAGCTGAGATCATGCCACTGCACTCTAGCCTGAGTGACAGAGCAAGACTCCATCTCAAAACAAAACAAAACAAAACATACAAGCAAACAAAAAATCTCTCAACTACCAAAAAATTATCCATTAACTGATATTCACTTTAATAAATAACCACTTTGGCAATTTTTTCCCTCACTTGACCTAACATTGACTAGATGGTCAACTCAATTCAGTTCAACAAATACTTCCAGATGATCCACCTACTCCATGCTTAATTCAAGCACAAAGCTAGAATGAGGAATTTACTCATTGCCACAGCAACTGAGGATGCACATTGTTAAGCATTTTAAAAGATCTGTCTTAAAAAAAAATAGTAATCTTTGCTACCAGCACCTAGCTTGCTTTAAAAGCATTTGTTAGATTCCTTCTCTGGCTTTGGCTTGGT\t*\tSA:Z:chrX,134477298,+,588S244M,60,2;\tMD:Z:6A646\tRG:Z:GATKSVContigAlignments\tNM:i:1\tAS:i:648\tXS:i:83", true);
        data.add(new AssemblyContigWithFineTunedAlignments(inv33));

        // has two alignments and indicates intra-chromosome ref order swap BND
        AlignedContig refOrderSwap = fromPrimarySAMRecordString("asm009941:tig00003\t0\tchr6\t147908\t60\t116S1276M\t*\t0\t0\tACCCTAAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAAACCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCCTAATCCTAACCCTAACCCTACCCTAACCCCTAACCCTAACCCTAACCCTGATTATTCAGGGCTGCAAACAGAAAGGATTTTGTTCACCGTCGATGCTGCCCTGAGTTGTCCCAAAGCGAGGCCGTGCCCCCAAGGTGTGTGCTGAGAAAGCTGCTCCGCGTTTTTGGTGTCCCCCGGGTCTGTGTTAAGCAGAACGCAGCTCTGCCCCCGCAAAGGCACCCCGCGCCGGCGCGGGCACGCACAGACTGACGCGACGTGCGCGCGGGAGGCGCGGTGGATGCGCAGAGAGCACGCCGCCGGGCGGGGGTTGGGGTGGCGTGGTGCAGGAGCACAGTCGCACGCCCCTGTGCTGGGGGTGGGGCGCGGTGCAGGCGCGGAGACGGGTGGAACCTCAGTAATTCGAAAAGCCGGGCTCGACCGCCCCCTGCTTGCAGCTGGGCACTACAGGACCCGCTTGGTCACGGTGCTGTGCCAGTGCGCCCCCTGCTGGCGACTAGGGCAGCTGCAGGGCTCTGTTGCTTATAGTGGTGGCCAGCGCCCCCTGCTGGCGCCGGGGCAATGCAGGGCCCTCTTGCTCACAGTATAGCGGCTGCACGCCGCCTGGTGGCAGCTAGGGACATTGCAGGGTCCTCTTGCTCACAGTGTGGTGGCAGCACACCCCCCTGCTGGCAGCTGGGGACACTGCCGGGCCCTCTTGCTTGCAGTGCAGTGGGGGCACGCCCTCTTCTGGCCCCTGGGGGCACTACAGGAACCTCTCGCTCACAGTGTAGTGGCAGCACGCCCCCTGTTGGCAACCAGGGCACTGCGGGGTCCTCTTGCTCATGGTGTGGTGCCCGTATGACACCTGCTGGCAGCTAAGGACACTGCAGGGCCCTGTTGCTCACAGTGTAGTCGTCGTACGCCACCTGCTGGCAGCTGGAGACACTGCCTGGCCCTCTTGGTGGCAGTGTCGAGGCAGCACGCCACCTGCAGGCAGATGGGGACTAGGCAGGGCTCTCTTGCTCCCAGTGTGACGGTTGGCGTCCCCTACTGGCTGCCTCCTGCACCACTTAAAGTCAGAGCATCAGTTTTTAAGCCCCATCAGTTCTGTAAATTCAACTGAAACGGAGCTAGTACTAGGGAGAGCTGATGTCCCAGTTCTTGTCTAACTTGGAAGAAAGATTTTCACCAAGAGGCAGTACAAAAATGGGAGACAACTTCATTGAAAAGAAATACAGTGTAAAGAGCTCATTGTAGAAAAATAGGG\t*\tSA:Z:chr1,10109,+,6S86M14I55M4I30M1197S,60,21;\tMD:Z:1276\tRG:Z:GATKSVContigAlignments\tNM:i:0\tAS:i:1276\tXS:i:822", true);
        data.add(new AssemblyContigWithFineTunedAlignments(refOrderSwap));

        // has two alignments and indicates inter-chromosome BND
        AlignedContig interChr = fromPrimarySAMRecordString("asm000047:tig00001\t16\tchr1\t1425870\t60\t1595M726S\t*\t0\t0\tCAGAGCACCAGGAGCTGGCTGGGGCTGGAGACTGGCGCTGCTGGAGCTGCAGCTGCCTGGCAGAGGGGAAACTGAGGTGGGGGTGTGGCTCTGGGACAGACATCAGGGCAGGACCTCCCTAGCCAGGGTCCACGGTCTGGCTGGGGGATGTGGACTGGCTGCAACGTGGGGCGGGGTTAAAGGTCTTCCAGGGCAGCCCTGGAGAGCACCACTCTGCATTGAGCACCGCCCGGGCCACAGGCCTGCAGTGGCAGGAGCATGAGTGAGCAGGGGAGGGAGACGGAGGAGGAGGAGGGGGGAGGTGGTGCTTCCGACACAGCGCCCATGCTGCCCCGGGGACCTCCCGACCACCAGGCCTCAGCCCTGACGTGCCCAGGGTGGTCGGGGCCCCCGCTGCTGCCCGGCCGGCTGCT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CCCTCCATCACCCTGCCCTGCTCCCCTCTTCTCCCCCTTCCCTCCATCATCCCGCCCGCTCCCCTCTCCACCCCTCCCCTTCCCCTCCATCACCCTGGACCCCCCCCCCCCCCCCCCCCCCCCGCCCGCCCCCCCCCCCGCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCTCCCTCCCCCTCCCCTCCCCTCTCTCCCCCTCCCCTCCCCTCTCTCCCCCTCCCCTCCCCTCTCTCCCCCTCCCCTCCCCTCTCTTCCCCTCCCCTCCCCTCTCTTCCCCTCCCCTGCCCTCCGTGGCGGGGGCGGGGCTGCGGGCGGGGGAGGCCGGGGTCGTAAGCCGGGAGCGCTGCGCGCCCAGCCAGGAAGGGGCAGCGGGGGCGACCCTCAGTTTTCCGGGCCGGGCCACGCGATGGGGTCGCGCGCGAGCTCGGAGGCCTCCCGGGGTTTCGCAGCGGCCGCCGGGTCACACCCAGGCGCAGAGTTGCTCGTCCTCGTCGGGGCGCCCCGGGGGGCGGCGGGGTCCGGGGGTCCCAGCGGGCGGAGGCAGCAGCGGGCGGAGGCGCCGGGCTAGGCGGGCGCGGACGGCCGAGGCGAGCACCAGCAGCGGCGGCAGCGAGAGAAGCCCGAACACGATGAGCGCCGCGGAGCCGCGGTCTGAGAACAGCGCGCGGCACCGGGGACCCGGAGCGGGGTGGACCTGGGGGCCGGGCGGGCCGTCAGTGGGGGGCGGGGCGGGGTAATGGAGGGCTGGGGGCAGGGCAGGGTGATGGAGGGGAGGGG\t*\tSA:Z:chr1,1427471,+,562M3D42M1717S,60,6;\tMD:Z:1037G557\tRG:Z:GATKSVContigAlignments\tNM:i:1\tAS:i:1590\tXS:i:26", true);
        data.add(new AssemblyContigWithFineTunedAlignments(interChr));

        return data;
    }

    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForComplexChimeraContigs() {
        final AlignedContig complexChimeraContig = fromPrimarySAMRecordString("asm000409:tig00002\t16\tchr1\t19931769\t60\t1125M3I52M1143S\t*\t0\t0\tCAAACTGACCAAACAGGCAAAGGATTTCCTTTCCCTTTCTATGTGCTCCTTTAAGGTCCTTTCCAACTCTTTCCCAATCTTTTAATTCCAAAGTTCCCTGTTCTGGGAACCAAGGGCAAAATTGTTCCACAGCATGAAAGAAATCCATAAGTTTTTCTGTATCAACTTTTACCCTACCATGCTTCAAGAGCTGCTGTAGCAAGCTCAAATACATGATGTACTTACTTTCAGTTTGTCCCATTTGTGTCCCTAGCTTTCTCCGAGTGCCCCGCTTACCTGCAGAGCTTGAAACTTTTTCATCCTTGGGAGTCCTTTGTCTGTTGGTCCTCTGTTTCACACACTTGAGTGTTCCTTCACCGGATTCTTTCAGGCCCCACGTTGGGCGCCAGAATGTTGGGGACCAGCCTCAACACCACCCGTAGGGTACCCAAAGTCCAATGGTGACAAAGGAATGAGAAAAGACAGGTTAAGAGTTCATAAAGGTGGGAGCCAGGGGACCAGTTGCAAAATGGAGGCTGCAAAAGGCTCAGAGCTCTGGTCTCCACACTATTTATTGGGTACAATCACTTAGATGTAAAAAGCAGATGTTCAGGGTGAAACAGTGAAAGGGTGGCAGTGCATCATAGGTGTAATTTATAGCAATAGTAGTTTAAATGAATCTCCTTGTGCTCAGTGTATCTTTAACTTATTGGAGAGTAGCTAGTGGGAGTGGGCTTAACTAGGAGCCTGCATGTCTGTCCGCATTCCCATGCTTCAAAGGAGTGTCTTTCTCCTGGAACACAGTGTTTACAAATAAGAGAGCGGGTCTCGCTCTGAGCATGGGAACATGATGGCAATTAGGAGGCTTTCCTCCTCAGAGGCCTTTTGTGGCTTTTCACAACTTATTTTCCTATATTTTTATGGCCAGTTTATACAGGCACCCCACAAGCCCTTTTCCCAACAATTTAAGTTTCCTGAGGCCTCCTGAGAAGCAGAAGCCACTATACTTCTTGTACAGCCTATAGAACCTCTTTTCTTTATAAATTACTCAGTTTCAGGTATTCCTTTATAACAACGCGAGAATGGACTAATAAAATCACCACATCATCATCCTCATCACCATTATCATCACCATCAACATCACTGTCATCATCACCATCATCATTATCACCATCACCATCATTATAGTTACCATCACCATAATTATCACCATCAACATCACCATCGGTGCCATCAACATCATCATCATCACCATCACCATCATCATCATCATTACCATTACCATCACCATCATCATCTTCACCATCACCATTGCACCATCACCATTATCATCATCATAATCACCATCAACATCACCATAATAATCATCACCATTATCATCATTATCACCATCACCATCATCATCATCATTACCATTACCATCACCATCATCATCTTCACCATCACCATCACCATTGCACCATCACCATTATCATCATCTTAATCACTATCAACATCACCATAATAATCACCATCACCATCACCATTATCATCATTATCACCATCACCATTATCACCATCATAATCATCATGAAATTACCATAATCATACTCACCATTACTATCACTGTCATCACCATCACAATCATTACCACTAACACCACCACCATCATCATCATCATCACCACCACCATCATCATCATTATCCTAACAATAAAGATGGCAGAACAAATGAATCTCATTTGTTAATGCCCCACATGGTGGCACTGTGCTGAGGGCCCTTATCTGCTACATCTCATCACTCAGCCTTATGTTGCTTCCCTCAGACCTTTAAGGATTTCTAAGCAAAATGGGATAACCTTATTCCTGGAAGAATTAATTGCTTCTTGAGTCAATAAACTATATTGAGGACCTAGTATGTGGTGGGCATCCATCAGAGAGCAAAACCAGGTGTGGTTCCTGCCCTCGTGGAGCTTACAGTCCAGTGGGGAGACAGATATTACTCATTACATACCGAATGGACACTTACAGATAGAGGTAAGTAGCTTGATAGAAAGTTCCATGGGGTTGGCCAGGTGTGGTGGCTCATGCCTGTAATCCCAGCATTTTGGGAGGCTGAGGTGGGTGGATCACAAGGTCAGGAGTTTGAGACCAGCCTGGCCAATATGGTGAAACCCTGTCTCTACTAAAAATACAAAAATTACCTGGGTGTGGTGGTGCGGGCCTGTAGTCCCAGTTACTTGGGAGGCTGAGGCAGAAGAATCGCTTAAACCCGGGAGGCGGAGGTTGCAGTTAGCCAAGATTGCACCACTGCACTCCAGCCTGGGTGACAGAGTGAGACTCCATCTCAAAAAAAAAAAAAAAAA\t*\tSA:Z:chr1,19932932,-,1491S832M,60,2;chr7,355947,-,1209S68M1046S,60,5;\tMD:Z:211T184A39G0G124G215T384A1C11\tRG:Z:GATKSVContigAlignments\tNM:i:11\tAS:i:1118\tXS:i:331", true);
        return Collections.singletonList(new AssemblyContigWithFineTunedAlignments(complexChimeraContig));
    }

    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForIncompleteAlignmentSignature_2aln() {

        final List<AssemblyContigWithFineTunedAlignments> data = new ArrayList<>(2);

        // has two alignments, incomplete due to head/tail containment
        AlignedContig headTailContainment = fromPrimarySAMRecordString("asm000128:tig00003\t0\tchr1\t3174861\t60\t1123M4I169M8D138M54S\t*\t0\t0\tGTTTGAGATAGAAACGGCAATTGATCATATTAATATTTAGCATGTTTGCAGAAACGGCTTTCTCAGTGCTATCAATCTGCTGTGTTAATAGCGGCCGCTTGGTTCTGGGCACAGACGCTCAGAAGGGGAATGCCAATGAGTCCCAGTGCCGCAGGGCAGCCGTGGTCCCGGGCTGGTCAGAAGGTGGGACCAGCGGCCAAGGCTCCTCCTAGCACCATTTCCTGGAGTTACGACAGCTTTGTTCTTGTCTCAAAGCCAAGATCCAGGGCGAGGGGAGAAGCTATTGCCTTTACCGCACAGTTTTAAAGACAGAAGAACAAGATAGAACTCCATCAGTTCCCAAGTTTCTCTTTCTAGCAAACTGTTTTTGGGAAGGGGCCTTCAGGATGACCCTGCCGCTCCAGGAGCCCTCCCACTGAAGAAGGGCCTTCTGTTCACCAGGGTATACTCGGCAGAGATGTAGGTGTACAGAATCCTCTGTGAGGAATGGGAACACCCTATTTTTTCTCTAGAAGTTGCCTCCGTGCGTGCCTGCTCTCCCCGATCAGCTCTCCCACAACCACAGCCTGCCTGATGCGCCCACCTCTCCCTCTCCCTGTTTTGTTCAGGGGGCAGGATGGCCCTTCACTGCTCATGGGGACTCATAGGCACCCAGTTGGGGGAACATTCTCCAGGTCTCTGACCCACTACACAGCACTCCTCCCTGCTTGGTTCTGAGAAGGAAAAGAGGAGCCAGAGGATGGGGCCCCAACAAGCCTCAGGTGGAAGCTGCAGTCCCGTGGAGCCAGGCACAGCTCCGGCCAAGTCCCAGAACTCAGACCTGCCCACCCGCCACATGGGTGCAGGGAGGGTGACAGCCGGTCAGCCCTGAAGAAGCAGCAGAGAAACCAGCCCTTTCTCCGAGGCAGGGCCTGGCTGAGAAAGCCCAGACGTTCCTCTCAGATGAGCCGATCAGGGTCAAGGGCAGAGAGGAGCCAGGGTTGTGTTAATGGAGCTTCACGGCTAGGGAAGGAAAGTCAGAAGTGGGAGTGAGGCTCCTGCCTTCTACCTCTTCTGTTGGAAACTGCCCTGGAGGTTGCCCTTACCCCATCCATCCATCCACTCACTCACCCATCCATCCATGCAGCCAGCCAGCCAGCCAGCCAGCCAGCCAGCCATCCCCTTATAAATCTATCCACCCATCCATCCCCTCATCCATCCATCCAACCATCCATCCATCCATCCATCCACCCATTGATTCACCTACCCATCCATTCATCCATTCCTTCATTAACCCATCCATGCACTCATTCATCTATCCATCCATCCATCCATCTATCCATCCATCCATTTACCCATCTATCCCCTCATCTATCCACCAAGCCATTCATCCACCTATCTATGCATTCATCCACCATCTGTCCATCCATCCATCCATCCATCCATCCATCCATCCATCCATCCACCCATTGATTCACCTACCCATCCATTCATCCATTCCTTCATTAA\t*\tSA:Z:chr1,3176048,+,1406S82M,60,1;\tMD:Z:162C1129^ATCCATCC130T7\tRG:Z:GATKSVContigAlignments\tNM:i:14\tAS:i:1376\tXS:i:52", true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailContainment));

        // has two alignments, incomplete due to head/tail overlap and ref order swap
        AlignedContig headTailRefOrderSwapAndOverlap = fromPrimarySAMRecordString("asm033434:tig00001\t16\tchrX\t16522928\t60\t975M732S\t*\t0\t0\tTGTGTGTGTCTTGATTTTAAGCATGCTGAGGCTGGGCACAGTGGCTCACGCCTCTAATACCAACACTTTGGGAGCCCAAGGTGAGAGGACCACTTGAGCCCAGGAGTTCAAGACCAGTCCAGGCAACATAAACATAGCAAGACTTCATCTCTATTTTCAAAAAATAAAAATAAAGGCCTGTTGACTCTGCTACACTAGCTGACATCCACACAGAGATATCCAAAAAGCTACTGGAAAAATATATCTGGTACACTTAGGGCACAGATGATTAAGAAGAGAGATTGAGATTCAATCATTAACAGAGACAGGGTGAAATGATCCACACTTTGAGTAGCAAGGCTCTAAAGTACCTTCCAGACGTTCAATTCTGTAATTGCCCAAAAATAAGGGAAAGTCATTGACAACATAATAAAGGCTCTGGAGGTCTAGTGGAAGGGAATTTGAAAGAAAAAAGATTGAGATTGGTAGAATGAAAGTATAAAAGAGGATCCTTTGTCATTGAGATCATTAAAGCTGGAAAAATTCTTCCTGTATATATATCAACAAAGTTTTATTTTTAAAATTTGTTGGTATGTGAAAAGGCGAATGATGAAAATAAGAAAAGGAATGCTTTAGGATACTTAGTCCCACTACTAACAAGGTAATGGTATAAACAAATGATTTAACAATAATGTAATAAAAAAGCCAGAACTCTGAAAGGAAATAAATATTCAAGACCTTCCTATGACACCTTACATCATTAATACTTTCCTATAGAAGTTTATTTACATGAAAATAGGCATTTGTATATGAAATAGGATACATCTAGACAGCCAATTTATTCACTTAAATAAAATCACAACCTGAAATGCTTTGTGTGTGTCTTGATTTTAAGCATGCTGAGGCTGGGCACAGTGGCTCACGCCTCTAATACCAACACTTTGGGAGCCCAAGGTGAGAGGACCACTTGAGCCCAGGAGTTCAAGACCAGTCCAGGCAACATAAACATAGCAAGACTTCATCTCTATTTTCAAAAAATAAAAATAAAGGCCTGTTGACTCTGCTACACTAGCTGACATCCACACAGAGATATCCAAAAAGCTACTGGAAAAATATATCTGGTACACTTAGGGCACAGATGATTAAGAAGAGAGATTGAGATTCAATCATTAACAGAGACAGGGTGAAATGATCCACACTTTGAGTAGCAAGGCTCTAAAGTACCTTCCAGACGTTCAATTCTGTAATTGCCCAAAAATAAGGGAAAGTCATTGACAACATAATAAAGGCTCTGGAGGTCTAGTGGAAGGGAATTTGAAAGAAAAAAGATTGAGATTGGTAGAATGAAAGTATAAAAGAGGATCCTTTGTCATTGAGATCATTAAAGCTGGAAAAATTCTTCCTGTATATATATCAACAAAGTTTTATTTTTAAAATTTGTTGGTATGTGAAAAGGCGAATGATGAAAATAAGAAAAGGAATGCTTTAGGATACTTAGTCCCACTACTAACAAGGTAATGGTATAAACAAATGATTTAACAATAATGTAATAAAAAAGCCAGAACTCTGAAAGGAAATAAATATTCAAGACCTTCCTATGACACCTTACATCATTAATACTTTCCTATAGAAGTTTATTTACATGAAAATAGGCATTTGTATATGAAATAGGATACATCTAGACAGCCAATTTATTCACTTAAATAAAATCACAACCTGAAATGCTTT\t*\tSA:Z:chrX,16522926,-,851S856M,60,0;\tMD:Z:975\tRG:Z:GATKSVContigAlignments\tNM:i:0\tAS:i:975\tXS:i:0", true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailRefOrderSwapAndOverlap));

        // has two alignments, incomplete due to head/tail overlap and strand switch
        AlignedContig headTailStandSwitchAndOverlap = fromPrimarySAMRecordString("asm033505:tig00005\t0\tchrX\t27013053\t60\t256S63M4D230M1I102M2D92M\t*\t0\t0\tATGGAAGGTAAACATTGAGTACATGTGGACTTAAAGATGGGAGCAATAGAAACTAAGGACTACTAGATAGGAGAAGGAGGGAGGTGAATGGGCTGAAAAACAACCTATTGGGTACTGTCTGGGTGGGATCATGTGTACCCCAAACTTCAGCATCACACAGTATACACATATACACACATATATATACACATATGTATATACACATATATGTAATATATCAATATACATATATGTAAATGTATGTGTATATATGTAAATATGTAAATATATGTATATATGTGTGTGTAAATATATGTATACATGTATATGTGTGTAAATATATGTATACATATATGTATATGTGTGAATATGTATGTGTATATGTAAATATATTTACATATATGCATAACGTGAATATGTATGTATGTAAATATATTTACATATCCTTACATATACGTATATATTTACATATATGCGTGTGTTTATAGCCATACACATTTACATGCATACATGTGTATACATGCACATTTACATATATGCATATTTACATATATTTACATATACATTCCCTTTTGCACATTATGTATTTACATATATTTACATAAACATGCATCTGTGTATTTACATATTTACATATATTTACATAAATATGCATTTATGTATTTACATATGCATATTTACATATATGCATATGTGTGTTTACATATGCACGTACACACATACATTTACATGTATACATATGTATATATACATATATTTACATAT\t*\tSA:Z:chrX,27013532,-,372S46M4D326M,60,6;\tMD:Z:10G3A1G46^TATG82A21A0T32A87G1G49G3G11G37^AT92\tRG:Z:GATKSVContigAlignments\tNM:i:19\tAS:i:372\tXS:i:0", true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailStandSwitchAndOverlap));

        return data;
    }

    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForIncompleteAlignmentSignature_multipleAln() {

        final List<AssemblyContigWithFineTunedAlignments> data = new ArrayList<>(2);

        String samString = "asm033796:tig00000\t16\tchrX\t66097492\t60\t244S98M2I1046M\t*\t0\t0\tATATACACACATGTGTGTATATGTGTATATACACACATGTGTGTATATGTGTATACATACACACATGTGCGTATATGTGTATACATACACACATATGCGTATATGTGTATATATGTATACATACACACATATGCATATATGTGTATATATGTATACATACACACATATGCATATATGTGTGTATATATGTATACATACACACATATGCATATATGTGTGTGTATATGTATACATACACACATGCATATATGTGTGTGTATATGTATACATACACACATATGCATATATGTGTGTGTATATGTATACATACATATATGCATATATGTGTATATATGTATACATACATATATGCATATATGTGTATATATGTATATACACACATACATGTATGTGTGTATATATGTATATACACACATACATGTATATGTGTTTATATGTATATACACATATACATGTATGTGTGTATATATATGTAAATAAGGACATTAAAGACAGTGCAGATAAATGGAATGATATTCCAAGTTTATGAATTAGAAGGATTAATTAGCTTCATTATGATAATTTTAAAACATGTGTGTGTACCAAATTGTCATGTTGTAAACCTTAAATGTATGCTCTTTAACTGGAGAGTATTACTCAATAAAAATTAAAATAGAAAAAACAAACCCAACTAACTACTGGGTACTAAGCTCACTATCTGAGTGATGGGATCATTCATACCCTACACCTTAGCCTCATACAATATACCCAAGTAACAATCCTGCACATGTATCCCCCCGAATCTAAAATAGAAGTTTAAAAAAATAAATTTTGCCTTTGAATGCTACTGCCTGAGCAAATACCCTAATATTAGATCCATTGTATGCTGCATTATGCACTATATGGTTCTTTATAAAGCATTGAAAAATATCTTAAAGTATCCATTTTATAGACAAAGTTAAAAAACATCTTCAGAGAAAGGAATCATAGATTATCCTTGAAGCTACCAAGAATTAGCAAATAAGCCATGAATGTAGGTTAGAGTACTTAAATTCAGAACGTATACATTTAACATCCTTTCCTGTTTTTGTAGTGTCAAATAGAAACTGCTATCTGCTATATTATTCATACCTGAATGGCTGTCTTGGATGCTGGTGACTTCATTTCTGATTTATACAGTGGTCTACTAGTCAGCCAGAGTTATATGATCCAAGCCATTGGAACATGAACAGCAGTCCAAGCACTAAAGCATTTGATTCCGTGCTGTGGTTTTACTTAAAAGAAGTAAAACTCACTAATGTGCCATGGAAAACAAGAGTTCAGTTTCTAAACTCAGAGGCAATCAAACTTAAAAACTTTGGAAATAAGCACCAGAAATCTTGATAATAATAAGCACTTCTTCAGTTCTGCA\t*\tSA:Z:chrX,66097492,-,170S84M1136S,56,3;chrX,66097499,-,139S60M1191S,60,2;\tMD:Z:121C22A22T234G741\tRG:Z:GATKSVContigAlignments\tNM:i:6\tAS:i:1106\tXS:i:42";
        // incomplete due to head/tail containment
        AlignedContig headTailContainment = fromPrimarySAMRecordString(samString, true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailContainment));

        // incomplete due to head/tail mapped to different chromosomes
        samString = "asm033751:tig00029\t16\tchr5\t46783745\t37\t410S314M1D126M1I276M\t*\t0\t0\tTTTTGTAGAATCTGTAAGTGTTCATTTGGAGTGCTTTGAAGCCTATGGTGGAAAAGGAAATATCTTCACATAAAAACTAGGCAGAAGCATTCGCAGAAAATTATGTGAGATGTGTGCATTCCACTAACGGATTTGAATCTTTCTATTCATAGAGCAGTACTGAAACAATCCTTTTGTAGAATCTGCTTGTGGATATTTGGAACTCTTTGAGGAAATCTTTGCAAACGGTTATCTTCATATAAAAACTATAGAGAAGCATTCTCAGAAAGTTCTTTGTGATGAGTGCATTCAACTCACAGAGTTAAACCTTTCTTTTGATAGAGCAGTGTTGACACATACCTTTTGTAGCATCTACAAGTGTTCATTTGTAGCGCTTTGGGGCCTATGGTGGAAAAGGAAATACCTTCACATAAAAACAAGACAGAATCATTCTCAGAAACACCTTTGTGATGTGTCTGTTCAATTCACAGAGTTGAACCTTTCTTTTGATAGAGCAATTTTGAAACATGGCTTTTGTAGAAATTGTTTGTGGATATTTGGAGCTCTTTGAGGAATTTGTTGCAAACGGGATACCTTCACATACACACTAGACAGAAGCATTGTCAGAAACTTCTTTGTCATGTGTGCATTCAACTCACAGAGTTGAACCTTCCTTTTGAGAGAGCAGTTTTGAAACCGTCTTTTTGTAGTATCTGGAAGTGGATATTTGGAGCTAATTGAGGCCATTGTGGAATAGGAAATATCTTCACATACAAACTAGACAGAAGCATTCTCAGAAACTGCTTTGTGATGTGTGCATTCAACCCACAGAGTTGAACCTTCCTTTTGAGAGAGCAGTTTCGAAACAGTCTTTTTGTAGTATCTGCAAGTGGATATTTGGTGCGATTTGAGGCCTATGATGAAAAAGGAAATATCTTCACATACAAACTAGACAGAAGCATCCTCAGAAACTGCTTTGTGATGTGTGCATTCAACTCATAGAGTTGAAAATTCCCTTTGAGAGAGCAGTTTTGAAACAGTCTTTTTGTAGTATCTGCAATTGGATTTTTGGAGCGATTTGAGGCCTAAGGTGGAAAATATAATATCTTCACATAAAAACTAGACAGAAGCATTCTCAGGAACTTCAT\t*\tSA:Z:chr12,37316333,-,207M920S,37,19;chr12,37283830,-,148S174M805S,37,13;\tMD:Z:7T72G14A1C38C37A16C9G6G34A14G7A17T0C17G1T8^T2G0A5A22G12A68G1T5G32A15G4G39T33C0G1C3T5C0T4T8G1A0G32G5A4T2T2C3G5C4A5G0G0A4C9C3G5C4T8A4C3\tRG:Z:GATKSVContigAlignments\tNM:i:58\tAS:i:405\tXS:i:370";
        AlignedContig headTailDiffChr = fromPrimarySAMRecordString(samString, true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailDiffChr));

        // incomplete due to head/tail mapped to opposite strands of same chromosomes
        samString = "asm025906:tig00004\t16\tchr15\t91048534\t60\t189M559S\t*\t0\t0\tCAGGAGTTCAAGACCAGCATGGGCAATAGAGCAAAACCCCATTTCTACTAAAAATACAAAAATTAGCTTGGCATGATGGCATGCATCTGTAGTCCCAGATATTTGGGAGGCTGAGGCAGGAGGATCACTTGAGCCTGGGAGGCAAAGGTTGCAGTGAGCCATGATTGTGCCACTGCACTCCAGCCTGGGCAACAGAGTGAGACTGTCTCAAAAAAATTTTTTTTTTTTTTTTGTAGATATGGGGTTTTGCTTTGCTGCCCAAGCTGGCGTTAGACTCCTGGCTTTAAGTGATTCTCCCACCTTGGCCTCCCAAAGTGCTAAGATTACAGGCATGAGCCACTGCAGCTGGCCACATTTCTTTTATTGCTCTCATGGTTATGAATGGTTTCATATATTTACTGGTCATTTCTACTTATTTTTAAGTTACATATCCATGCCCTGTTCCCATGCCTGTTGGGAATATGTCTTTTTCCTATTGATTTGTACTGATATTAACCCTCTGTCTGACATACATTGAATGCTCCTGATTTATCATTTCCTTATGAATTTTGTTTCTGAGATTTTTGCGTCATAAACAAATCTTTTTGTGATTGCGTTTCCAATCTTTCCTTTAGGGTTTCTGATTTCCATTTTAAACTTAGGATGGCCTCCTAAGTTTTAATCCTTAGGATTGACATTATACAAATGTTTTCCCTACTTCCTTTTCTTATCTTTTTGGTATCCCTTTTCACTTTTTTTTTTTTTTTTT\t*\tSA:Z:chr15,78662854,+,216S125M407S,60,11;chr9,11803145,-,285S67M396S,0,2;chr12,22550783,-,162S56M530S,60,0;chr1,36282390,-,209S36M503S,60,0;\tMD:Z:37T122G28\tRG:Z:GATKSVContigAlignments\tNM:i:2\tAS:i:179\tXS:i:82";
        AlignedContig headTailOppoStrand = fromPrimarySAMRecordString(samString, true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailOppoStrand));

        // incomplete due to head and tail alignment have reference order switch
        samString = "asm008278:tig00002\t2064\tchr4\t102408175\t60\t736H411M210H\t*\t0\t0\tTGTATACATATGTATACATATATAAATACTATATATGTGTATCTATGTATATATGTATACATATGTATACATATATAAATACATATATATAGTCATTTTATATATATATAGTCATTCAACGTTCAGTCACCTTTTGATTGAGATATATGTGCTTGATACTGATGAATATGCATGTGTTTGTTTCTCCAAGCAAGATTTTTCAAATAAAGTGTTTCAAAGGACAGGCCATAGGCTGGGGAAAATTCTGCATGCCTCCCACTTCTCAGCAGTTTCCTTTATTCTCCTCCCTCCTCATGCCAAAACACCCTACATATGTATATACATATGTATACATATGTATACATATATAAATACTATATATGTGTATCTATGTATATATGTATACATATGTATACATATATAAATACATAT\t*\tSA:Z:chr4,102410693,-,295S424M638S,60,2;chr4,102408175,-,1061S296M,60,1;chr4,102409920,-,342M1015S,60,27;\tMD:Z:6T404\tRG:Z:GATKSVContigAlignments\tNM:i:1\tAS:i:406\tXS:i:0";
        AlignedContig headTailOrderSwap = fromPrimarySAMRecordString(samString, true);
        data.add(new AssemblyContigWithFineTunedAlignments(headTailOrderSwap));

        // incomplete due to valid region overlaps but doesn't contain completely middle alignments
        samString = "asm022207:tig00002\t16\tchr12\t76122005\t60\t880S155M20D268M15D158M\t*\t0\t0\tATATATAATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAACATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAACATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATAATATATTTCATATATATAATATATATATTTCATATATATAATATATTTCATATATAATATATATATTTCATATATATAATATATTTCATATACATAATATATATATTTCATATATATAATATATTTCATATATATAATATATTTCATATATATAATATATATTTCATATATATAATATATATATTTCATATATATAATATATTTCATATATAATATATTTCATATATATAATATATATATTTCATATATATAATATATATTTCATATATATATTTCTTATAAATATATATTTCATATATAGGATATTTCATATATATAGTATATTTCATATATATAATATATTTCCATATATAATATATATTTCATATATATAATATATTTCATATATAATATATATATTTCATATATATATTTCACATATATAATATATTTCATATATAATATATATATTTCATATATATATTTCATATATAATATATATTTCATATATATATTTCATATATAATATATATATTTCATATATATATTTCATATATAATATATATATTTCATATATAATATATATTTCATATATAATATATATATTTCATATATAATATATATTTCATATATATATTTCATACATAATATATATATTTCATATATATATTTCATATATAATATATATATTTCATATATATATTTCATATATAATATATATATTTCATATATATAATATATATATTTTATATATATTATATATATATTTCATATATATAATATATATATTTCATATATAATATATATATTTCATATATATAATATATTTCGTATATATAGTATATTTCATATATATAATATATTTCATATATAATAGATATATTTCACATATATAATATATTTCATATACATAAGATATTTCATATATACATTTCATATACATAAGATATTTCATATATATTTCATATATATGTTTCATATATATGCTTCATATATATGTTTCATATATATGCTTCATATATATGTTTCATATATATGCTTCATATATATGTTTCATATATATGCTTCATATATATGTTTCATATATATGCTTCATATATATGTTTCATATATATGCTT\t*\tSA:Z:chr12,76120936,+,1006S108M4D34M4D34M4D34M4D15M1D19M4D34M4D34M4D34M4D34M3D34M41S,2,52;chr12,76122083,-,805S31M2D92M533S,19,3;chr12,76121096,+,862S24M4D37M17D41M20D40M2I71M3I24M357S,3,51;chr20,58949681,-,710S62M689S,0,3;chr12,76122319,-,41M4D32M1388S,17,6;chr12,76122327,-,770S55M636S,60,3;chrUn_JTFH01001681v1_decoy,82,-,716S57M688S,9,1;\tMD:Z:14A4G135^ATATATATATTTCATATATA158C35T73^ATTTCATATATATGC158\tRG:Z:GATKSVContigAlignments\tNM:i:39\tAS:i:494\tXS:i:141";
        AlignedContig headAndTailContainedByMiddle = fromPrimarySAMRecordString(samString, true);
        data.add(new AssemblyContigWithFineTunedAlignments(headAndTailContainedByMiddle));

        return data;
    }

    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForAmbiguousAlignmentSignature() {

        AlignmentInterval one = fromSAMRecordString("asm000008:tig00000\t0\tchr3\t198124752\t60\t672M\t*\t0\t0\tGCTCATGGGAGGACAGTTCTGCCCACCCCAGCTCATCTCTCCAGCTCAGCCTGCATGTATGCCTTCCTCCAACTGATTCCAGAGTAGGGGATGGGAGGTCTCACGTTGACCTCAAGTTTAAGTGACTTTTTCCACCTCTGCTTTCCCAGACAGCCCTTGCTGTGGGACTTGTAAGGAGATTTGTGAGGTCAGTATCTACTTTTCTTGTGTGGGTGTTTATAAATTATTCCCCTGGAGGGGAATAAATGTTAGAGGTACTCCAAACCCCTAACATATAAACATCTAAGCCTGGCCCTTTTTTGGTGGTAAAATATACACAACATAAAACTTACCATTTTAACCATGTTTAAACGTACAGTTGAGTGGCATCCAGTATAATGTGTTGTACAACCATCTCCTTTATCCATATCTACAACTTCTTTATCAGCCTAAACTGAAACACCAAACCCATAAATAAGTCTTTGAATAGAAGACTGATGCATTTGACTCCATACAAATTAAAACTTTATAGGCGAGAAAAATGCCTCAAAGTCAAAAGTGAACAGACTGGGGAAATAGATCTGCAACATACATGACAGACAAAAAGCTAATTTGGGTAATATATATGTATATATATAGCTATATAGCTATCCTAAATTATTAAAAGACCAACAGCCAAATTGAAAAATGGAC\t*\tSA:Z:chr3_KI270784v1_alt,110136,-,672M,26,0;\tMD:Z:120T13T51A87G397\tRG:Z:GATKSVContigAlignments\tNM:i:4\tAS:i:652\tXS:i:582", true);
        AlignmentInterval two = fromSAMRecordString("asm000008:tig00000\t2064\tchr3_KI270784v1_alt\t110136\t26\t672M\t*\t0\t0\tGTCCATTTTTCAATTTGGCTGTTGGTCTTTTAATAATTTAGGATAGCTATATAGCTATATATATACATATATATTACCCAAATTAGCTTTTTGTCTGTCATGTATGTTGCAGATCTATTTCCCCAGTCTGTTCACTTTTGACTTTGAGGCATTTTTCTCGCCTATAAAGTTTTAATTTGTATGGAGTCAAATGCATCAGTCTTCTATTCAAAGACTTATTTATGGGTTTGGTGTTTCAGTTTAGGCTGATAAAGAAGTTGTAGATATGGATAAAGGAGATGGTTGTACAACACATTATACTGGATGCCACTCAACTGTACGTTTAAACATGGTTAAAATGGTAAGTTTTATGTTGTGTATATTTTACCACCAAAAAAGGGCCAGGCTTAGATGTTTATATGTTAGGGGTTTGGAGTACCTCTAACATTTATTCCCCTCCAGGGGAATAATTTATAAACACCCACACAAGAAAAGTAGATACTGACCTCACAAATCTCCTTACAAGTCCCACAGCAAGGGCTGTCTGGGAAAGCAGAGGTGGAAAAAGTCACTTAAACTTGAGGTCAACGTGAGACCTCCCATCCCCTACTCTGGAATCAGTTGGAGGAAGGCATACATGCAGGCTGAGCTGGAGAGATGAGCTGGGGTGGGCAGAACTGTCCTCCCATGAGC\t*\tSA:Z:chr3,198124752,+,672M,60,4;\tMD:Z:672\tRG:Z:GATKSVContigAlignments\tNM:i:0\tAS:i:672\tXS:i:652", true);
        AlignedContig chr3 = new AlignedContig("asm000008:tig00000", "GCTCATGGGAGGACAGTTCTGCCCACCCCAGCTCATCTCTCCAGCTCAGCCTGCATGTATGCCTTCCTCCAACTGATTCCAGAGTAGGGGATGGGAGGTCTCACGTTGACCTCAAGTTTAAGTGACTTTTTCCACCTCTGCTTTCCCAGACAGCCCTTGCTGTGGGACTTGTAAGGAGATTTGTGAGGTCAGTATCTACTTTTCTTGTGTGGGTGTTTATAAATTATTCCCCTGGAGGGGAATAAATGTTAGAGGTACTCCAAACCCCTAACATATAAACATCTAAGCCTGGCCCTTTTTTGGTGGTAAAATATACACAACATAAAACTTACCATTTTAACCATGTTTAAACGTACAGTTGAGTGGCATCCAGTATAATGTGTTGTACAACCATCTCCTTTATCCATATCTACAACTTCTTTATCAGCCTAAACTGAAACACCAAACCCATAAATAAGTCTTTGAATAGAAGACTGATGCATTTGACTCCATACAAATTAAAACTTTATAGGCGAGAAAAATGCCTCAAAGTCAAAAGTGAACAGACTGGGGAAATAGATCTGCAACATACATGACAGACAAAAAGCTAATTTGGGTAATATATATGTATATATATAGCTATATAGCTATCCTAAATTATTAAAAGACCAACAGCCAAATTGAAAAATGGAC".getBytes(), Collections.singletonList(one));
        AlignedContig alt = new AlignedContig("asm000008:tig00000", "GCTCATGGGAGGACAGTTCTGCCCACCCCAGCTCATCTCTCCAGCTCAGCCTGCATGTATGCCTTCCTCCAACTGATTCCAGAGTAGGGGATGGGAGGTCTCACGTTGACCTCAAGTTTAAGTGACTTTTTCCACCTCTGCTTTCCCAGACAGCCCTTGCTGTGGGACTTGTAAGGAGATTTGTGAGGTCAGTATCTACTTTTCTTGTGTGGGTGTTTATAAATTATTCCCCTGGAGGGGAATAAATGTTAGAGGTACTCCAAACCCCTAACATATAAACATCTAAGCCTGGCCCTTTTTTGGTGGTAAAATATACACAACATAAAACTTACCATTTTAACCATGTTTAAACGTACAGTTGAGTGGCATCCAGTATAATGTGTTGTACAACCATCTCCTTTATCCATATCTACAACTTCTTTATCAGCCTAAACTGAAACACCAAACCCATAAATAAGTCTTTGAATAGAAGACTGATGCATTTGACTCCATACAAATTAAAACTTTATAGGCGAGAAAAATGCCTCAAAGTCAAAAGTGAACAGACTGGGGAAATAGATCTGCAACATACATGACAGACAAAAAGCTAATTTGGGTAATATATATGTATATATATAGCTATATAGCTATCCTAAATTATTAAAAGACCAACAGCCAAATTGAAAAATGGAC".getBytes(), Collections.singletonList(two));
        return Arrays.asList(new AssemblyContigWithFineTunedAlignments(chr3, Collections.emptyList(), true, (AlignmentInterval) null),
                new AssemblyContigWithFineTunedAlignments(alt, Collections.emptyList(), true, (AlignmentInterval) null));
    }

    private List<AssemblyContigWithFineTunedAlignments>
    buildDataForUnInformativeAlignmentSignature() {
        AlignmentInterval one = fromSAMRecordString("asm000008:tig00017\t0\tchr4\t189976910\t37\t52M6I335M2I104M3I18M2I140M3I96M78S\t*\t0\t0\tCTTTTACTACTTCTATTTAATATAGTACTGAAGGTTCTAGTTAGTTAAAACAATAAGGTGAGTAAAAGAATAAAAGATATTCCAATTTTTTAAAAAGCAAAATTATCTGTTTGCAGATGACATAAACTTATGTATTAAAAATCTTTTAGTTTCTGTGAAATAAACTGTCAGACGCAATACCTAAAATTCAGGAAAGCTGCAGGATACAAAATCAATACACAAAAATCAGTTGTATTTCTACAATAACAATAAACTATATGAAGAAGAAATCAAGAAAACAGTATCATGTATGATAGCATCAAAAGAATAAAATACTTGGAAACCCACTTAACCAAGGAAATAAAAAACCTGTACAGCAAAAACTATAAACATGGCATGAAAGTATTAAAGATGACACAAATAAATGAAAAGACGTCATGTGTTTATGGAATGGAAGACAAAACCTTGTCAAGATGTCATTGTTATCTATAGTCATCTACAGATTCAATAAAATCACTATAAAAAAAATTCCAATATTTGCAAAAAAATAGAAAAACTTATTCTAAAATTCAGATGAAATCTCAAAAAATCCCAAGTAGCCAAATCAATCTAAAAAATTAATAAATTTAGGGGAATAACACCTCCTGGTTTCAAACTTACTGCAATGCTTCAGTACCCAAAACTTGTTGTACCAGCGTAGAGACAGACACAAAGACCAATGCAATAGAAATAAAGAACTGAAAAATATGGTCATGATTTTTAACAAGGGAGTCAACGCTATTTAACGATATTTTTTAAATGGTGTTTAAAACGGATATTTACATATATATATATATATATATATATATATATATATATAT\t*\tSA:Z:chrUn_JTFH01001343v1_decoy,163,-,332M3I157M1D347M,60,12;\tMD:Z:14G16G1A51T5T27C5A15G24T0A5A0A0C9C65C17C41A18A4G38C30A15C25C75C53T5C3C3G4A3C58A10G14G15C0A25C0A9A5\tRG:Z:GATKSVContigAlignments\tNM:i:54\tAS:i:459\tXS:i:424", true);
        AlignmentInterval two = fromSAMRecordString("asm000008:tig00017\t2064\tchrUn_JTFH01001343v1_decoy\t163\t60\t332M3I157M1D347M\t*\t0\t0\tATATATATATATATATATATATATATATATATATATATGTAAATATCCGTTTTAAACACCATTTAAAAAATATCGTTAAATAGCGTTGACTCCCTTGTTAAAAATCATGACCATATTTTTCAGTTCTTTATTTCTATTGCATTGGTCTTTGTGTCTGTCTCTACGCTGGTACAACAAGTTTTGGGTACTGAAGCATTGCAGTAAGTTTGAAACCAGGAGGTGTTATTCCCCTAAATTTATTAATTTTTTAGATTGATTTGGCTACTTGGGATTTTTTGAGATTTCATCTGAATTTTAGAATAAGTTTTTCTATTTTTTTGCAAATATTGGAATTTTTTTTATAGTGATTTTATTGAATCTGTAGATGACTATAGATAACAATGACATCTTGACAAGGTTTTGTCTTCCATTCCATAAACACATGACGTCTTTTCATTTATTTGTGTCATCTTTAATACTTTCATGCCATGTTTATAGTTTTTGCTGTACAGGTTTTTTATTTCCTTGGTTAAGTGGGTTTCCAAGTATTTTATTCTTTTGATGCTATCATACATGATACTGTTTTCTTGATTTCTTCTTCATATAGTTTATTGTTATTGTAGAAATACAACTGATTTTTGTGTATTGATTTTGTATCCTGCAGCTTTCCTGAATTTTAGGTATTGCGTCTGACAGTTTATTTCACAGAAACTAAAAGATTTTTAATACATAAGTTTATGTCATCTGCAAACAGATAATTTTGCTTTTTAAAAAATTGGAATATCTTTTATTCTTTTACTCACCTTATTGTTTTAACTAACTAGAACCTTCAGTACTATATTAAATAGAAGTAGTAAAAG\t*\tSA:Z:chr4,189976910,+,52M6I335M2I104M3I18M2I140M3I96M78S,37,54;\tMD:Z:225G3T4C7G21T201T22^T71G149G125\tRG:Z:GATKSVContigAlignments\tNM:i:12\tAS:i:760\tXS:i:459", true);
        AlignedContig alignedContig = new AlignedContig("asm000008:tig00000", "CTTTTACTACTTCTATTTAATATAGTACTGAAGGTTCTAGTTAGTTAAAACAATAAGGTGAGTAAAAGAATAAAAGATATTCCAATTTTTTAAAAAGCAAAATTATCTGTTTGCAGATGACATAAACTTATGTATTAAAAATCTTTTAGTTTCTGTGAAATAAACTGTCAGACGCAATACCTAAAATTCAGGAAAGCTGCAGGATACAAAATCAATACACAAAAATCAGTTGTATTTCTACAATAACAATAAACTATATGAAGAAGAAATCAAGAAAACAGTATCATGTATGATAGCATCAAAAGAATAAAATACTTGGAAACCCACTTAACCAAGGAAATAAAAAACCTGTACAGCAAAAACTATAAACATGGCATGAAAGTATTAAAGATGACACAAATAAATGAAAAGACGTCATGTGTTTATGGAATGGAAGACAAAACCTTGTCAAGATGTCATTGTTATCTATAGTCATCTACAGATTCAATAAAATCACTATAAAAAAAATTCCAATATTTGCAAAAAAATAGAAAAACTTATTCTAAAATTCAGATGAAATCTCAAAAAATCCCAAGTAGCCAAATCAATCTAAAAAATTAATAAATTTAGGGGAATAACACCTCCTGGTTTCAAACTTACTGCAATGCTTCAGTACCCAAAACTTGTTGTACCAGCGTAGAGACAGACACAAAGACCAATGCAATAGAAATAAAGAACTGAAAAATATGGTCATGATTTTTAACAAGGGAGTCAACGCTATTTAACGATATTTTTTAAATGGTGTTTAAAACGGATATTTACATATATATATATATATATATATATATATATATATATAT".getBytes(), Collections.singletonList(two));
        return Collections.singletonList(new AssemblyContigWithFineTunedAlignments(alignedContig, Collections.singletonList(one.toPackedString()), false, (AlignmentInterval) null));
    }

}
